/**
 * 
 */
package tk.sunlatus.project.task.reload.domain;

import org.apache.log4j.Logger;
import org.quartz.JobExecutionException;

import tk.sunlatus.project.config.ConfigurationManager;


/**
 * 定时加载配置文件
 * @author Sunlotus
 * 
 */
public class ReloadJob {

    private static final Logger LOGGER = Logger.getLogger(ReloadJob.class);

    private ConfigurationManager configurationManager = null;

    private boolean reloadAllFlag = false;

    public void execute() throws JobExecutionException {
        // TODO log
        LOGGER.debug("Reload job runing...\n\t{reloadAllFlag=" + reloadAllFlag + "}");
        if (reloadAllFlag) {
            getConfigurationManager().reloadAll();
        } else {
            getConfigurationManager().reload();
        }
        LOGGER.debug("Reload job run success.");
    }

    public boolean isReloadAllFlag() {
        return reloadAllFlag;
    }

    public void setReloadAllFlag(boolean reloadAllFlag) {
        this.reloadAllFlag = reloadAllFlag;
    }

    public ConfigurationManager getConfigurationManager() {
        return configurationManager;
    }

    public void setConfigurationManager(ConfigurationManager configurationManager) {
        this.configurationManager = configurationManager;
    }

}
